<!--  -->
<template>
    <section class="page-follow">
        <div class="follow_content">Follow @Harvest Gain on social for new product releases, healthy tips, and more.
        </div>
        <div class="follow_list">
            <div v-for="(item, index) in images" :key="index" class="image-item">
                <div class="image-box">
                    <img :src="item.image" class="thumbnail" />
                    <!-- 悬浮层（由伪类或兄弟选择器控制） -->
                    <div class="tooltip">
                        <h3 class="tooltip_title">Advanced Magnesium Glycinate</h3>
                        <p class="tooltip_info">Supports a calm, relaxed mood*</p>
                        <div class="shop-now-btn" @click="toDetail(item.url)">Shop Now</div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</template>

<script>
const image1 = require("../../assets/images/bounty/product/1.jpg");
const image2 = require("../../assets/images/bounty/product/2.jpg");
const image3 = require("../../assets/images/bounty/product/3.jpg");
const image4 = require("../../assets/images/bounty/product/4.jpg");
const image5 = require("../../assets/images/bounty/product/5.jpg");

export default {
    data() {
        return {
            images: [
                {
                    image: image1,
                    title: "Advanced Magnetic Glycolics",
                    info: "your heart health and prevent heart disease.",
                    url: 'products?productId=42'
                },
                {
                    image: image2,
                    title: "Advanced Magnetic Glycolics",
                    info: "your heart health and prevent heart disease.",
                    url: 'products?productId=40'
                },
                {
                    image: image3,
                    title: "Advanced Magnetic Glycolics",
                    info: "your heart health and prevent heart disease.",
                    url: 'products?productId=38'
                },
                {
                    image: image4,
                    title: "Advanced Magnetic Glycolics",
                    info: "your heart health and prevent heart disease.",
                    url: 'products?productId=41'
                },
                {
                    image: image5,
                    title: "Advanced Magnetic Glycolics",
                    info: "your heart health and prevent heart disease.",
                    url: 'products?productId=39'
                },
            ],
        };
    },
    mounted() {

    },
    methods: {
        toDetail(url) {
            window.location.href = url;
        }
    },
}
</script>
<style scoped lang="less">
.instagram__blocks {
    display: flex;
    gap: 7px;
    align-items: center;
    justify-content: center;
}

.instagram .instagram__title {
    font-weight: 700;
    text-align: center;
    padding: 10px;
    margin: 15px 0;
    font-size: 18px;
}

.instagram__item {
    position: relative;
    cursor: pointer;
    height: auto;
    flex-grow: 0;
    flex-shrink: 0;
    flex-basis: calc(20% - 14px);
    height: max-content;
}

.instagram__item img {
    max-width: 100%;
    height: auto;
    width: 100%;
    display: flex;
}

.instagram {
    padding-bottom: 50px;
}

@media (max-width: 992px) {
    .follow_list {
        grid-template-columns: repeat(2, 1fr);
    }

    .follow_content {
        padding: 0 30px;
        text-align: center;
        font-size: 2.2rem;
    }

    .image-item {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .image-box {
        width: 100% !important;
        height: auto !important;
    }
}

@media (min-width: 1680px) {
    .follow_list {
        grid-template-columns: repeat(5, 1fr);
    }
}

.page-follow {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 245px;
    padding: 30px 0;

    .follow_list {
        width: 100%;
        max-width: 1400px;
        display: grid;
        // grid-template-rows: 1fr 1fr;
        justify-content: center;
        flex-wrap: wrap;
        column-gap: 10px;
        margin-top: 40px;

        .image-box {
            width: 272px;
            height: 272px;
            position: relative;
            cursor: pointer;
            overflow: hidden;
        }

        .thumbnail {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .tooltip {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            color: white;
            opacity: 0;
            transition: opacity 0.3s ease;
            z-index: 100;
            backdrop-filter: blur(6px);
            padding: 16px;
            box-sizing: border-box;

            .tooltip_title {
                text-align: center;
                color: #d2e38f;
            }

            .tooltip_info {
                text-align: center;
                color: #fff;
                margin-top: 14px;
            }

            .shop-now-btn {
                max-width: 200px;
                padding: 8px 10px;
                width: 100%;
                font-size: 16px;
                background-color: #d2e38f;
                color: #27463a;
                border: 1px solid #d2e38f;
                transition: all 0.2s ease-in-out;
                margin-top: 30px;
                border-radius: 20px;
                text-align: center;
                font-weight: 500;
                cursor: pointer;
            }

            .shop-now-btn:hover {
                background-color: rgba(0, 0, 0, 0);
                border: 1px solid #ffffff;
                transition: all 0.2s ease-in-out;
                color: #ffffff;
            }
        }

        .image-box:hover {
            .tooltip {
                opacity: 1;
                transition: opacity 0.3s ease;
            }

            .thumbnail {
                transform: scale(1.07);
            }
        }
    }
}
</style>